
import 'package:development_assistant/config/db_config.dart';
import 'package:sqflite/sqflite.dart';

class EnvService{
  Database database=DBConfig.getDatabase();
  String tableName="env_type";

  Future setEnv(Map<String,Object> envType) async{
    switch (envType['env_name']){
      case "Testing":
        envType['env_name']="测试环境";
        break;
      case "Formal":
        envType['env_name']="正式环境";
        break;
      case "Experience":
        envType['env_name']="体验环境";
        break;
      case "Cloud":
        envType['env_name']="云端环境";
        break;
    }
    await database.update(tableName,envType,where: "env_name=?",whereArgs: [envType['env_name']]);
  }

  Future envInfo(String envType) async{
    var type=envType;
    switch (envType){
      case "Testing":
        type="测试环境";
        break;
      case "Formal":
        type="正式环境";
        break;
      case "Experience":
        type="体验环境";
        break;
      case "Cloud":
        type="云端环境";
        break;
    }

    return await database.query(tableName,where: "env_name=?",whereArgs: [type]);
  }
}